﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebCrawling.Data.Extracting
{
    /// <summary>
    /// Common regular Expressions
    /// </summary>
    [Serializable]
    public struct RegularExpressionLibrary
    {
        #region Internet Patterns

        /// <summary>
        /// Matches CSS selectors and returns groups of selector[propertyname:propertyValue]
        /// use to parse CSS in a string or file
        /// http://stackoverflow.com/a/2694121/899290
        /// </summary>
        public const String CSSGroups = @"(?<selector>(?:(?:[^,{]+),?)*?)\{(?:(?<name>[^}:]+):?(?<value>[^};]+);?)*?\}";

        /// <summary>
        /// Regex matching CSS Comments
        /// </summary>
        public const String CSSComments = @"(?<!"")\/\*.+?\*\/(?!"")";

        /// <summary>
        /// Regex matching javascript
        /// </summary>
        public const String JavaScript = @"<script[^>]*>([\s\S](?!<script))*?</script>";

        #endregion
    }
}
